<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			
		</div>
		
		
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/vue-router.js" type="text/javascript" charset="utf-8"></script>
		<script src="node_modules/axios/dist/axios.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			
			
			var App={
				template:`
					<div>
						<button @click='senAjax'>发请求</button>
						<ul>
							<li v-for="item in data1" :key="item.id">
							    {{ item }}
							  </li>
						</ul>
					</div>
				`,
				data(){
					return{
						data1:[]
					}
				},
				methods:{
					senAjax(){
						this.$axios.default.baseURL='http://127.0.0.1:8080';
						this.$axios.get('/jianzhi')
						.then(res=>{
							console.log(res);
							console.log(res.data);
							this.data1=res.data;
							console.log(this.data1);
						})
						.catch(err=>{
							console.log(err);
						})
					}
				}
			}
			//挂载到原型上
			Vue.prototype.$axios=axios;
			new Vue({
				el:"#app",
				// router,
				template:"<App />",
				components:{
					App
				}
			});
		</script>
	</body>
</html>
